<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
		   prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath%>"><!-- jsp文件头和头部 -->
	<meta charset="utf-8">
	<title>访客记录</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="static/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="static/layui/css/public.css" media="all">
</head>
<body>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-body" style="padding: 15px;">
			<form class="layui-form" action="">
				<div class="layui-from-item">
					<div class="layui-inline">
						<label class="layui-form-label">受访人信息:</label>
						<div class="layui-input-inline">
							<input type="text" name="sname" id="sname" autocomplete="off"placeholder="姓名、电话" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">受访日期:</label>
						<div class="layui-input-inline">
							<input type="text" name="vtime" id="vtime" autocomplete="off"placeholder="YYYY-MM-DD" class="layui-input">
						</div>
					</div>
					<div class="layui-from-item"style="margin-top: 10px">
					<div class="layui-inline">
						<label class="layui-form-label">事务状态:</label>
						<div class="layui-input-inline">
							<select name="incheck">
								<option value="">请选择</option>
								<option value="已确认">已确认</option>
								<option value="未确认">未确认</option>
							</select>
						</div>
					</div>
					<div class="layui-inline" style="margin-left:30px">
						<button type="submit" class="layui-btn layui-btn-primary" lay-submit  lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
					</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<table class="layui-hide" id="test"></table>

<!-- 引入 -->
<script type="text/javascript" src="static/ehome/js/jquery-1.8.3.min.js"></script>
<script src="static/layui/layui.js" charset="utf-8"></script>
<script src="static/js/myjs/head.js" charset="utf-8"></script>
<script>
	$(top.hangge());
        layui.use(['form', 'table','laydate','util'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table,
                laydate = layui.laydate,
                util = layui.util;

		table.render({
			elem:'#test'
			,url:'<%=basePath%>visitor/visitorlist.do'
			,cellMinWidth:80
			,defaultToolbar: []
			,cols:[[
				{type:'numbers',width:80,title:'序号'},
				{field:'sname', width:120, align:"center", title: '受访人姓名'},
				{field:'vname', width:100,  align:"center", title: '访客姓名'},
				{field:'vdept', width:160,  align:"center", title: '访客单位'},
				{field:'sdept', width:120,  align:"center", title: '受访人部门'},
				{field:'stel', width:120,  align:"center", title: '受访人电话'},
				{field:'vtime', width:120,  align:"center", title: '登记日期'},
				{field:'incheck', width:100, align:"center", title: '事务状态'},
				{field:'vtext', width:345,  align:"left", title: '来访事由'},
			]]
			,limits: [10, 15, 20, 25, 50, 100]
			,limit: 15
			,page:true
			,done: function (res, curr,count) {
				$('th').css({ 'line-height':'50px','background-color':'#f1f1f1','vertical-align': 'middle','display': 'table-cell', 'color': 'black', 'font-size': '16px'});
				$('tr').css({'line-height':'50px'})
			}
		});
        laydate.render({     //创建时间选择框
            elem: '#vtime' //指定元素
        });

		form.on('submit(data-search-btn)', function (data) {
			let sname = data.field.sname;
			let stel = data.field.stel;
			let vtime = data.field.vtime;
			let incheck = data.field.incheck;

			table.reload('test', {
				url: '<%=basePath%>visitor/searchlist.do',
				method:'POST',
				where: {sname:sname,stel:stel,vtime:vtime,incheck:incheck},
				page: {
					curr: 1
				}});
			return false;
		});

	});
</script>
</body>
</html>

